package com.example.pathprotectsystem.controller;

import com.example.pathprotectsystem.pojo.AskList;
import com.example.pathprotectsystem.pojo.PageBean;
import com.example.pathprotectsystem.pojo.Result;
import com.example.pathprotectsystem.pojo.ResultModel;
import com.example.pathprotectsystem.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class RecordController {
    @Autowired
    private RecordService recordService;
    @PostMapping("/f1list")
    public Result<PageBean<ResultModel>> f1list(@RequestBody AskList askList){
        PageBean<ResultModel> p = recordService.f1list(askList);
        return Result.success(p);
    }
    @DeleteMapping("/deletef1")
    public Result deletef1(int id){
        recordService.deletef1(id);
        return Result.success();
    }
    @PostMapping("/f2list")
    public Result<PageBean<ResultModel>> f2list(@RequestBody AskList askList){
        PageBean<ResultModel> p = recordService.f2list(askList);
        return Result.success(p);
    }
    @DeleteMapping("/deletef2")
    public Result deletef2(int id){
        recordService.deletef2(id);
        return Result.success();
    }
    @PostMapping("/f3list")
    public Result<PageBean<ResultModel>> f3list(@RequestBody AskList askList){
        PageBean<ResultModel> p = recordService.f3list(askList);
        return Result.success(p);
    }
    @DeleteMapping("/deletef3")
    public Result deletef3(int id){
        recordService.deletef3(id);
        return Result.success();
    }
    @PostMapping("/f4list")
    public Result<PageBean<ResultModel>> f4list(@RequestBody AskList askList){
        PageBean<ResultModel> p = recordService.f4list(askList);
        return Result.success(p);
    }
    @DeleteMapping("/deletef4")
    public Result deletef4(int id){
        recordService.deletef4(id);
        return Result.success();
    }
    @PostMapping("/f5list")
    public Result<PageBean<ResultModel>> f5list(@RequestBody AskList askList){
        PageBean<ResultModel> p = recordService.f5list(askList);
        return Result.success(p);
    }
    @PostMapping("/liqingpavementdamagesheetlist")
    public Result<List<ResultModel>> liqingpavementdamagesheetlist(@RequestBody ResultModel resultModel){
        String finishTime = resultModel.getFinishTime();
        String userName = resultModel.getUserName();
        String pathName = resultModel.getPathName();
        List<ResultModel> p = recordService.pavementdamagesheetlist(finishTime,userName,pathName);
        return Result.success(p);
    }
    @PostMapping("/shuinipavementdamagesheetlist")
    public Result<List<ResultModel>> shuinipavementdamagesheetlist(@RequestBody ResultModel resultModel){
        String finishTime = resultModel.getFinishTime();
        String userName = resultModel.getUserName();
        String pathName = resultModel.getPathName();
        List<ResultModel> p = recordService.shuinipavementdamagesheetlist(finishTime,userName,pathName);
        return Result.success(p);
    }
}
